﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Globalization;

namespace NerdDinnerReloaded.Models
{
    public class NerdDinnersInitializer : RecreateDatabaseIfModelChanges<NerdDinnersDB>
    {
        protected override void Seed(NerdDinnersDB context)
        {
            var dinners = new List<Dinner>
            {
                new Dinner { Title = "Sample Dinner 1", 
                             EventDate=DateTime.Parse("31/12/2010", new CultureInfo("en-GB")), 
                             Address="One Microsoft Way",
                             HostedBy="scottgu@microsoft.com",
                             CreatedBy = "Bikal Gurung",
                             CreatedOn = DateTime.Now,
                             ModifiedBy = "Bikal Gurung",
                             ModifiedOn = DateTime.Now },

                new Dinner { Title = "Sample Dinner 2", 
                             EventDate=DateTime.Parse("31/05/2011", new CultureInfo("en-GB") ), 
                             Address="Somewhere else",
                             HostedBy="scottgu@microsoft.com",
                             CreatedBy = "Bikal Gurung",
                             CreatedOn = DateTime.Now,
                             ModifiedBy = "Bikal Gurung",
                             ModifiedOn = DateTime.Now }

            };
            dinners.ForEach(d => context.Dinners.Add(d));
        }
    }
}